/*
 * Copyright 2009 SHOP.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.shop.opensocial.mediated.services;

import com.shop.opensocial.mediated.types.ActivityMediator;
import com.shop.opensocial.mediated.types.CollectionOptionsMediator;
import com.shop.opensocial.mediated.types.UserIdMediator;
import com.shop.opensocial.mediated.types.GroupIdMediator;
import com.shop.opensocial.mediated.types.SecurityTokenMediator;
import com.shop.opensocial.mediated.request.MediatedRequest;
import java.util.List;
import java.util.Set;

/**
 * Independent mediator for OpenSocial Activity Service
 *
 * @author Jordan Zimmerman
 */
public interface ActivityServiceMediator
{
	/**
	 * Returns a list of activities that correspond to the passed in users and group.
	 *
	 * @param request request data
	 * @param userIds The set of ids of the people to fetch activities for.
	 * @param groupId Indicates whether to fetch activities for a group.
	 * @param appId   The app id.
	 * @param fields  The fields to return. Empty set implies all
	 * @param options The sorting/filtering/pagination options
	 * @param token   A valid SecurityToken @return a response item with the list of activities.
	 * @throws Exception errors
	 * @return list of activities
	 */
	public List<ActivityMediator> getActivities(MediatedRequest request, Set<UserIdMediator> userIds, GroupIdMediator groupId, String appId, Set<String> fields, CollectionOptionsMediator options, SecurityTokenMediator token) throws Exception;

	/**
	 * Returns a set of activities for the passed in user and group that corresponds to a list of
	 * activityIds.
	 *
	 * @param request request data
	 * @param userId	  The set of ids of the people to fetch activities for.
	 * @param groupId	 Indicates whether to fetch activities for a group.
	 * @param appId	   The app id.
	 * @param fields	  The fields to return. Empty set implies all
	 * @param options	 The sorting/filtering/pagination options
	 * @param activityIds The set of activity ids to fetch.
	 * @param token	   A valid SecurityToken @return a response item with the list of activities.
	 * @throws Exception errors
	 * @return list of activities
	 */
	public List<ActivityMediator> getActivities(MediatedRequest request, UserIdMediator userId, GroupIdMediator groupId, String appId, Set<String> fields, CollectionOptionsMediator options, Set<String> activityIds, SecurityTokenMediator token) throws Exception;

	/**
	 * Returns an activity for the passed in user and group that corresponds to a single
	 * activityId.
	 *
	 * @param request request data
	 * @param userId	 The set of ids of the people to fetch activities for.
	 * @param groupId	Indicates whether to fetch activities for a group.
	 * @param appId	  The app id.
	 * @param fields	 The fields to return. Empty set implies all
	 * @param activityId The activity id to fetch.
	 * @param token	  A valid SecurityToken @return a response item with the list of activities.
	 * @throws Exception errors
	 * @return the activity
	 */
	public ActivityMediator getActivity(MediatedRequest request, UserIdMediator userId, GroupIdMediator groupId, String appId, Set<String> fields, String activityId, SecurityTokenMediator token) throws Exception;

	/**
	 * Deletes the activity for the passed in user and group that corresponds to the activityId.
	 *
	 * @param request request data
	 * @param userId	  The user.
	 * @param groupId	 The group.
	 * @param appId	   The app id.
	 * @param activityIds A list of activity ids to delete.
	 * @param token	   A valid SecurityToken. @throws Exception errors
	 * @throws Exception errors
	 */
	public void deleteActivities(MediatedRequest request, UserIdMediator userId, GroupIdMediator groupId, String appId, Set<String> activityIds, SecurityTokenMediator token) throws Exception;

	/**
	 * Creates the passed in activity for the passed in user and group. Once createActivity is called,
	 * getActivities will be able to return the Activity.
	 *
	 * @param request request data
	 * @param userId   The id of the person to create the activity for.
	 * @param groupId  The group.
	 * @param appId	The app id.
	 * @param fields   The fields to return.
	 * @param activity The activity to create.
	 * @param token	A valid SecurityToken
	 * @throws Exception errors
	 */
	public void createActivity(MediatedRequest request, UserIdMediator userId, GroupIdMediator groupId, String appId, Set<String> fields, ActivityMediator activity, SecurityTokenMediator token) throws Exception;
}
